package com.lemo.controller;


import java.util.List;

import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.task.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ActivitiService {
	
	@Autowired
	private RuntimeService runtimeService;
	
	@Autowired
	private TaskService taskService;
	
	
	public void  start(){
		runtimeService.startProcessInstanceByKey("travelPay");
	}
	
	
	public void  complete(String taskId){
		taskService.complete(taskId);
	}
	
	/*
	 * 查询当前人的任务
	 */
	public List<Task>  queryTask(String assignee){
		 return taskService.createTaskQuery().taskAssignee(assignee).list();
	}
}
